const a = 12328765
const b = 7654231234

function add(n, m) {
  const strm = m.toString()
  const strn = n.toString()
  let lenm = strm.length
  let lenn = strn.length
  if (lenm > lenn) {
    strn.padStart(lenm, '0')
  } else {
    strm.padStart(lenn, '0')
  }

  let cur = 0
  for (let i = lenm - 1; i >= 0; i--) {
    let numm = strm[i]
    let numn = strn[i]
    console.log(numm,numn)
    if(numm+numn+cur){
        cur = 1
    }else{
        cur = 0
    }
    strm[i]=(numm+numn+cur)%10
  }
  return strm

}

console.log(add(a, b));
